package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.javaBean.MerchantBean
import fhp.hlhj.giantfold.javaBean.SellersBean
import fhp.hlhj.giantfold.network.UrlApis

/**
 * author: FHP
 * data: on 2018\1\31 0031 15:09
 * E-Mail: 103945089@qq.com
 */
class SellersModule {
    interface onLoadSellerListener{
        fun showLoading()
        fun getSellers(sellersBean: SellersBean)
        fun getMerchants(merchantBean: MerchantBean)
    }

    fun getSellers(listener: onLoadSellerListener){
        UrlApis.getSellers()
                .doOnSubscribe {
                    listener.showLoading()
                }
                .subscribe({
                    data->
                    listener.getSellers(data)
                })
    }

    fun getMerchantDetail(params: HttpParams,listener: onLoadSellerListener){
        UrlApis.getMerchantDetail(params)
                .subscribe {
                    data->
                    listener.getMerchants(data)
                }
    }
}